<template>
<!--作为导航栏的存在-->
  <div style="height: 60px;line-height: 50px;border-bottom: 1px solid #ccc;display: flex">
    <el-menu
        :default-active="$route.path" router
        class="el-menu-demo"
        mode="horizontal"
        :ellipsis="false">
      <img src="@/assets/museum.png" alt="" style="width:60px;position:relative;left: 20px">
      <div class="title" index="0" style="width: 250px;padding-left: 30px; font-weight: bolder;color: deepskyblue;font-size: 24px">宁夏数字工艺博物馆</div>
<!--      <div />-->
      <div style="padding-left: 360px"></div>
<!--      <i class="iconfont icon-gouwuche">购物车</i>-->
        <el-menu-item index="home">首页</el-menu-item>
        <el-sub-menu index="visit">
          <template #title>导览</template>
          <el-menu-item index="/appointment" :route="{path:'/appointment'}">在线订票</el-menu-item>
          <el-menu-item index="/transport" :route="{path:'/transport'}" id="transport">交通路线</el-menu-item>
          <el-menu-item index="/notice" :route="{path:'/notice'}" id="notice">游览须知</el-menu-item>
        </el-sub-menu>
        <el-sub-menu index="exhibition" >
          <template #title>展览</template>
          <el-menu-item index="/recentExhibition">近期展览</el-menu-item>
          <el-menu-item index="/specialMuseum">专馆</el-menu-item>
<!--          <el-menu-item index="/collections">藏品详情</el-menu-item>-->
        </el-sub-menu>
        <el-sub-menu index="products">
          <template #title>文创</template>
          <el-menu-item index="/mall">文创商城</el-menu-item>
  <!--        <el-menu-item index="3-2"></el-menu-item>-->
  <!--        <el-menu-item index="3-3">item three</el-menu-item>-->
        </el-sub-menu>

        <!-- <div @click="handleTo3D" class="link">虚拟博物馆</div> -->
        <el-menu-item index="ue4">虚拟博物馆</el-menu-item>
    </el-menu>

    <div>
<!--      新增头像-->
<!--      <img >-->
    </div>
    <div style="width: 100px;margin-top: 20px;flex: 1;text-align: right;padding-right: 50px">
      <el-dropdown size="medium">
        <span class="el-dropdown-link" style="cursor: pointer">
          <el-avatar :size="42" :src="user.avatar" style="margin:-12px 8px"></el-avatar>
          {{user.userName}}
          <el-icon class="el-icon--right">
            <arrow-down />
          </el-icon>
        </span>
        <template #dropdown>
          <el-dropdown-menu>
<!--            直接-->
            <el-dropdown-item @click="this.$router.push('/person')">个人信息</el-dropdown-item>
            <el-dropdown-item @click="this.$router.push('/order?userName='+user.userName)">个人订单</el-dropdown-item>
            <!--            $router.push('/login')-->
            <el-dropdown-item @click="this.$router.push('/login')">退出系统</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>
    </div>
  </div>
</template>

<script>
import { ArrowDown } from '@element-plus/icons-vue'
import Cookies from 'js-cookie'
export default {
  name: "Header",
  data(){
    return{
      user: Cookies.get('user') ? JSON.parse(Cookies.get('user')) :{}
    }

  },
  components:{
    ArrowDown
  },
  methods:{
    handleTo3D(){
      window.open("http://ve.cool360.com/PiECPkV/index.html");
    }
  },

}
</script>

<style scoped >
.el-dropdown-link {
  cursor: pointer;
  color: #24dcf3;
  display: flex;
  align-items: center;
}
/*消除边框*/
:focus{
  outline:0;
}
.flex-grow {
   flex-grow: 1;
}

.link {
  padding: 3px 10px 0 10px;
  font-size: 14px;
  color: rgb(68, 67, 67);
  
}

.link:hover {
  color: rgb(70, 153, 213);
  background-color: #ecf4f6;
  cursor: pointer;
}

/*隐藏导航栏小箭头*/



</style>